<template>
  <div class="card" v-loading="loading" :style="`height: ${height}`" :class="{ shadow: shadow }">
    <template v-if="$slots.title">
      <slot name="title"></slot>
    </template>
    <template v-else>
      <div class="card-title" v-if="title">
        <div class="titleBox">
          <!-- <span class="block"></span> -->
          <img src="../../assets/images/title-arrow.png" class="arrow" />
          {{ title }}
        </div>
        <slot v-if="$slots.headerRight" name="headerRight"></slot>
      </div>
    </template>

    <slot name="content"></slot>
  </div>
</template>

<script>
export default {
  name: "index",
  props: {
    loading: { type: Boolean, default: false },
    height: { type: String, default: "auto" },
    title: { type: String, default: "" },
    shadow: { type: Boolean, default: true },
  },
};
</script>

<style lang="less" scoped>
.card {
  padding: 20px;
  background: #ffffff;
  border-radius: 2px;
  overflow: hidden;
  &.shadow {
    box-shadow: 0 2px 11px 0 rgba(161, 161, 161, 0.2);
  }
  .card-title {
    font-size: 20px;
    border-bottom: 1px solid rgba(161, 161, 161, 0.2);
    margin-bottom: 20px;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    // font-weight: 600;
  }
}
.titleBox {
  display: flex;
  align-items: center;
  background: linear-gradient(to right, #0b5fd5 0%, #e6f2ff 100%);
  width: 100%;
  height: 40px;
  color: #ffffff;
  padding-left: 20px;
  .arrow {
    height: 20px;
    margin-right: 10px;
  }
}
.block {
  width: 4px;
  height: 16px;
  background: #0a6bf3;
  border-radius: 4px 4px 4px 4px;
  display: inline-block;
  margin-right: 5px;
}
</style>

<style lang="less">
.card + .card {
  margin-top: 20px;
}
</style>
